package main

import (
	"fmt"
	"time"
)

var name = make(map[int]int)

func main() {
	var names = []string{"a", "b", "c", "d"}
	bigMap := make(map[string]struct{})
	go func() {
		for {
			for _, v := range names {
				bigMap[v] = struct{}{}
			}
		}
	}()
	for {
		_, ok := bigMap["a"]
		fmt.Println(ok)
		time.Sleep(1 * time.Second)
	}
}

//会报fatal error: concurrent map read and map write的错误
//正确写法参见map5
